|
|
Following is my first ever 3d scene. Could someone please give me
pointers what could be done better, more elegantly?
Thanks
------------------------------
#include "colors.inc"
#include "arrays.inc"
camera {
location <9,7,10>
look_at <0,-5,0>
}
light_source { <10,10,20> color White*.6}
light_source { <10,10,10> color White}
#declare R1 = seed(666);
#macro Face_Dots (Dot_Array, rot)
#local i = 0;
#local to = dimension_size(Dot_Array,1) - 1;
#if (to>0)
merge {
#else
object {
#end
#while (i<=to)
sphere {
<Dot_Array[i][0],0,Dot_Array[i][1]>,
0.55
}
#local i=i+1;
#end
pigment {White}
finish {diffuse 0.5}
scale .5
translate y*1.2
rotate rot
}
#end
#macro Die(Pigment)
difference {
intersection {
box {
<-1,-1,-1>,
<1,1,1>
}
sphere {
<0,0,0>,
1.4
}
pigment {Pigment}
finish {diffuse 0.4}
}
Face_Dots (array[6][2] {{1,1}, {0,1}, {-1,1}, {1,-1}, {0,-1},
{-1,-1}}, <0,0,0>)
Face_Dots (array[1][2] {{0,0}}, <180,0,0>)
Face_Dots (array[2][2] {{-1,-1}, {1,1}},<90,0,0>)
Face_Dots (array[5][2] {{-1,-1}, {1,1}, {1,-1}, {-1,1},
{0,0}},<-90,0,0>)
Face_Dots (array[3][2] {{-1,-1}, {0,0}, {1,1}},<0,0,-90>)
Face_Dots (array[4][2] {{-1,-1}, {-1,1}, {1,-1}, {1,1}},<0,0,90>)
}
#end
#macro Rot (Seed)
Rand_Array_Item (array[4] {0,90,180,270}, Seed)
#end
#local Size=5;
#local Spacing=2.1;
#local i=-Size;
#while (i<=Size)
#local j=-Size;
#while (j<=Size)
object {
Die (rgb<rand(R1),rand(R1),rand(R1)>)
rotate <Rot(R1),Rot(R1),Rot(R1)>
translate <i*Spacing,1+rand(R1),j*Spacing>
}
#local j=j+1;
#end
#local i=i+1;
#end
Post a reply to this message
|
|